﻿using Mammoth.Entities;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace Mammoth.Mappings
{
    public class ValasEntityMapping : EntityMapping<ValasEntity>
    {
        public const int NameLength = 15;
        
        public ValasEntityMapping()
        {
            Table("tabel_valas");
            Property(x => x.Name);
            Property(x => x.Sell);
            Property(x => x.Buy1);
            Property(x => x.Buy2);
            Property(x => x.Buy3);
            Property(x => x.Type1);
            Property(x => x.Type2);
            Property(x => x.Type3);
            Bag<OrderEntity>(x => x.Orders, 
                p => {
                    p.Key(k => k.Column(c => c.Name("ValasId")));
                }, 
                r => r.OneToMany());
        }
    }
}
